output:
html_document:
number_sections: yes
theme: cerulean
toc: yes
toc_depth: 5
toc_float: yes
pdf_document:
toc: yes
toc_depth: '5'
This will add a table of contents (toc) and will change the colors (theme: cerulean)
To find your favorite Rmarkdown theme: https://www.datadreaming.org/post/r-markdown-theme-gallery/
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.
## Error: <text>:3:1: unexpected input
## 2: max.height #good
## 3: _
## ^
ggplot2 dplyr gapminder
by name
by logicals
combining logicals
CHALLENGE 2! Write a subsetting command to return the values in x that are greater than 4 and less than 7
Challenge 3
https://bookdown.org/yihui/rmarkdown-cookbook/
But why?
new chunk: Cmd + option + i or cntrl + alt + i (windows!)
another reason to name your chunks: chunk names become figure file names
Chunk Options:
echo=FALSE to avoid having the code itself shown.results="hide" to avoid having any results printed.eval=FALSE to have the code shown but not evaluated.warning=FALSE and message=FALSE to hide any warnings or messages produced.fig.height and fig.width to control the size of the figures produced (in inches).Bold
Italic
Bold and Italic
subscripts:) and super scripts:)
links: text to show
equations : \(E = mc^2\)
looks like code
longer looks like code
Images
from your computer
from the internet
Tables
Or for a dataframe:
also check out kableExtra package: https://bookdown.org/yihui/rmarkdown-cookbook/kableextra.html
Shortcut: ctrl/cmd + shift + k
Example: https://maggimars.github.io/OctobeR/october_r_course.html
Lets do it!
Navigate to github.com and sign in if you aren’t already
click repositories
click new
Make a new repo - name it something nice - do not initiate a read me or anything else - click create
In the terminal:
git branch -M main
git remote add origin https://github.com/maggimars/test.git
git push -u origin main
Then we will add our knited html (and anything else you want!)
git add october_r_course.html
git commit -m "added the knitted html file"
git push
then settings > Pages
Change branch to main and save.
Your knitted Rmarkdown is now a website!!!!